#include "Sort.h"

void Swap(int* pa, int* pb)
{
	int tmp = *pa;
	*pa = *pb;
	*pb = tmp;
}

void InsertSort(int* a, int n)
{
	for (int j = 1; j < n; j++)
	{
		int end = j;

		for (int i = end - 1; i >= 0; i--)
		{
			if (a[end] < a[i])
				Swap(&a[i], &a[end]);
			--end;
		}
	}
}
